<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>用户管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			var provinceId = $("#province").val();
			findtemplate(provinceId);
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		function findtemplate(v) {
		    $.ajax({
		        type : "post",
		        async : false,
		        url : "${ctx}/sys/yongUser/cityData",
		        data : {
		            'id' : v
		        },
		        dataType : "json",
		        success : function(msg) {
		            $("#city").empty();
		            $('#s2id_city').find('.select2-chosen').text('所在市');
		            if (msg.length > 0) {
		                for (var i = 0; i < msg.length; i++) {
		                        var partId = msg[i].id;
		                        var partName = msg[i].name;
		                        var $option = $("<option>").attr({
		                            "value" : partId
		                        }).text(partName);
		                        $("#city").append($option);
		                }
		                $("#city").change();
		            }
		        },
		        error : function(json) {
		            $.jBox.alert("网络异常！");
		        }
		    });
		}
		function resetFunc(){
			$("#searchForm input[type='text']").val("");
			$('#s2id_companyType').find('.select2-chosen').html('所有');
			$("#companyType").find("option")[0].selected='selected';
			$('#s2id_province').find('.select2-chosen').html('所在省');
			$("#province").find("option")[0].selected='selected';
			$('#s2id_city').find('.select2-chosen').html('所在市');
			$("#city").html("<option value=''>所在市</option>");
			$("#city").find("option")[0].selected='selected';
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sys/commonUser/vipUserList">会员用户审核列表</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="yongUser" action="${ctx}/sys/commonUser/vipUserList" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li>
				<label>企业名称：</label>
				<form:input path="company" htmlEscape="false" maxlength="50" class="input-small"/>
			</li>
			<li>
				<label>企业类型：</label>
				<form:select id="companyType" path="companyType" class="input-medium">
			    <form:option value="" label="所有"/>
			    <form:options items="${fns:getDictList('company_type')}" htmlEscape="false" itemValue="value" itemLabel="label"/>
			    </form:select>
			</li>
			<li>
				<label>企业认证时间：</label>
				<input name="startTime" type="text" placeholder="开始时间" readonly="readonly" class="input-medium Wdate " 
					value="<fmt:formatDate value="${user.startTime }" pattern="yyyy-MM-dd HH:mm:ss"/>"
			         onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
			     -
			     <input name="endTime" type="text" placeholder="结束时间" readonly="readonly" class="input-medium Wdate " 
					value="<fmt:formatDate  value="${user.endTime }" pattern="yyyy-MM-dd HH:mm:ss"/>"
			     onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> 
			</li>
			</ul>
			<ul class="ul-form">
			<li>
				<label>用户名：</label>
				<form:input path="loginName" htmlEscape="false" maxlength="50" class="input-small"/>
			</li>
			<li>
				<label>手机号码：</label>
				<form:input path="mobile" htmlEscape="false" maxlength="50" class="input-small"/>
			</li>
			<li>
            	<label>所在地区:</label>
				<form:select id="province" path="province" class="input-small" onchange="findtemplate(this.options[this.options.selectedIndex].value);">
				<form:option value="" label="所在省"/>
				<form:options items="${province}" htmlEscape="false" itemValue="id" itemLabel="name"/>
				</form:select>
				<form:select id="city" path="city" class="input-small" >
				<form:option value="" label="所在市"/>
				</form:select>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/></li>
			<li class="btns"><input class="btn btn-primary" type="button" value="重置" onclick="resetFunc()"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<form:form id="exports" modelAttribute="yongUser" action="${ctx}/sys/commonUser/export" method="post" >
	</form:form>
	<div style="display:none;">
		<sys:message content="${message}"/>
	</div>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>序号</th>
				<th>用户名</th>
				<th>手机号码</th>
				<th>企业名称</th>
				<th>企业类型</th>
				<th>联系人</th>
				<th>联系电话</th>
				<th>所在地区</th>
				<th>企业认证时间</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="user" varStatus="index">
			<tr>
				<td>${index.index+1}</td>
				<td>${user.loginName}</td>
				<td>${user.mobile }</td>
				<td><a href="${ctx}/sys/commonUser/companyDetail?id=${user.id}">${user.company }</a></td>
				<td>${fns:getDictLabel(user.companyType, 'company_type', '')}</td>
				<td>${user.linkman }</td>
				<td>${user.linkmanPhone }</td>
				<td>${user.provinceName }${user.cityName }</td>
				<td><fmt:formatDate value="${user.companyCreateTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td><a href="${ctx}/sys/commonUser/companyAuditing?id=${user.id}">审核</a></td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>